namespace WebSiteFool.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.UserProfile",
                c => new
                    {
                        UserId = c.Int(nullable: false, identity: true),
                        UserName = c.String(),
                    })
                .PrimaryKey(t => t.UserId);
            
            CreateTable(
                "dbo.Article",
                c => new
                    {
                        Id = c.Guid(nullable: false, identity: true),
                        Title = c.String(),
                        Content = c.String(),
                        CreateDate = c.DateTime(nullable: false),
                        UpdateDate = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Picture",
                c => new
                    {
                        Id = c.Guid(nullable: false, identity: true),
                        Image = c.Binary(),
                        CreatedDate = c.DateTime(nullable: false),
                        Picture_Id = c.Guid(),
                        Article_Id = c.Guid(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Picture", t => t.Picture_Id)
                .ForeignKey("dbo.Article", t => t.Article_Id)
                .Index(t => t.Picture_Id)
                .Index(t => t.Article_Id);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Picture", new[] { "Article_Id" });
            DropIndex("dbo.Picture", new[] { "Picture_Id" });
            DropForeignKey("dbo.Picture", "Article_Id", "dbo.Article");
            DropForeignKey("dbo.Picture", "Picture_Id", "dbo.Picture");
            DropTable("dbo.Picture");
            DropTable("dbo.Article");
            DropTable("dbo.UserProfile");
        }
    }
}
